package ui;

import java.awt.Insets;

import javax.swing.JTextArea;
import javax.swing.border.Border;
import javax.swing.border.CompoundBorder;
import javax.swing.border.EmptyBorder;

public class BorderTextArea extends JTextArea {
	private static final long serialVersionUID = 1L;
	private Border border;
	private Border dborder;

	public BorderTextArea() {

	}

	public BorderTextArea(Border enabledBorder,
			Border disabledBorder, boolean enabled) {
		Border empty = new EmptyBorder(0, 5, 0, 0);
		Border border = new CompoundBorder(enabledBorder, empty);
		Border dborder = new CompoundBorder(disabledBorder, empty);
		this.border = border;
		this.dborder = dborder;

		this.setBorder(enabled ? border : dborder);
		this.setMargin(new Insets(5, 5, 5, 5));
	}

	@Override
	public void setEnabled(boolean enabled) {
		this.setBorder(enabled ? border : dborder);
		super.setEnabled(enabled);
	}
}
